[6.x] Asset validation error per asset#11988
[6.x] Asset validation error per asset#11988godismyjudge95 wants to merge 16 commits intostatamic:6.xfrom
Conversation
jasonvarga
left a comment
There was a problem hiding this comment.
Would you mind please keeping the scope of this PR to showing the individual asset validation errors?
Please separate the changes to the rules themselves into a separate PR. The rules we're using are based on native Laravel validation.
I believe those changes are necessary to get the assets to individually validate. The way the rules were set up currently I could not get separate validation messages for each asset. I may have overlooked a way to do so; I will double check. |
|
Sorry I mean, the classes can change if they need to, but the logic/messages shouldn't. e.g. The dimensions rule should continue to just say "invalid image dimensions" - not give specific "must have a ratio of x" etc messages. |
Oh ok, yeah I can revert that |
|
Uh... I think these tests failing are unrelated? I just merged from master and now it's failing. 🫠 |
|
Don't worry about failing tests from |
Good catch! I think I now have all of the whole field validation rules listed here now: if (Str::of($rule)->before(':')->is(['array', 'required', 'nullable', 'max', 'min'])) { |
0dae11a to
ba4cfb5
Compare

This is a 6.x port of this PR - #11648
It resolves:
regexandnot_regexdon't work with Assets (arrays) #6246We've had a number of clients contact us with confusion about the validation errors that are shown when using asset validation rules. Specifically things like the dimensions rule or mime type cause confusion when it just gives a generic "invalid data" error instead of telling you what asset is invalid and why.
This PR solves that by doing three things:
In theory everything should work the same - I only had to change a single test which called the
->passes()method directly on the dimension rule.Here is a what it looks like with invalid assets:
The asset grid does not appear to be styled for me, so I assume that is still under development. I wanted to get these changes PR'd though so whoever is working on that can incorporate them into it.
Update: the UI looks much better now.